/*
 * TestHash.cpp
 *
 *  Created on: 29/10/2009
 *      Author: hernan
 */


#include "../Util/Compresor/Arithmetic/Dynamic/ContextTable.h"
#include <iostream>


using namespace std;


class TestContextTable {

public:

	ContextTable *tabla;

public:

	void Setup () {
		tabla = new ContextTable(256);
	}

	void UpdateTabla() {

		char a =  static_cast<char>(0);

		char b =  static_cast<char>(1);

		char c =  static_cast<char>(2);

		char d =  static_cast<char>(3);



		tabla->updateTable(a, b);

		tabla->updateTable(a, b);

		tabla->updateTable(a, b);

		tabla->updateTable(a, c);

		tabla->updateTable(b, a);

		tabla->updateTable(b, c);

		tabla->updateTable(b, d);


		return;
	}

	void GetProbability(){

		char a =  static_cast<char>(0);

		char b =  static_cast<char>(1);

		char c =  static_cast<char>(2);

		char d =  static_cast<char>(3);

		char e =  static_cast<char>(4);

		float resultado = tabla->F(a,c);

		cout << resultado << endl;

		resultado = tabla->F(a,c);

		cout << resultado << endl;

		resultado = tabla->F(a,d);

		cout << resultado << endl;

		resultado = tabla->F(a,e);

		cout << resultado << endl;


		resultado = tabla->F(b,a);

		cout << resultado << endl;

	}

	void Terminar () {
		delete tabla;

		cout << "Se completo TestContextTable"<< endl;
	}

	void Run() {
		Setup();
		UpdateTabla();
		GetProbability();
		Terminar();
	}


};

